Component({
  data: {
    activeIndex: 0,
    list: [
      {
        pagePath: "/pages/books/main",
        text: "首页",
        iconPath: "/static/imgs/show.png",
        selectedIconPath: "/static/imgs/showactive.png",
      },
      {
        pagePath: "/pages/search/main",
        text: "任务",
        iconPath: "/static/imgs/task.png",
        selectedIconPath: "/static/imgs/taskactive.png",
      },
      {
        pagePath: "/pages/personal/main",
        text: "我的",
        iconPath: "/static/imgs/my.png",
        selectedIconPath: "/static/imgs/myactive.png",
      },
    ],
  },
  methods: {
    handleProxy(e) {
      const url = this.data.list[e.currentTarget.dataset.index].pagePath;
      wx.switchTab({
        url,
      });
      this.setData({
        activeIndex: e.currentTarget.dataset.index,
      });
    },
  },
});
